//
//  BaseCollectionViewController.m
//  xiuPai
//
//  Created by apple on 16/10/26.
//  Copyright © 2016年 JLXX--YZG. All rights reserved.
//
#import "YZGCollectionViewController.h"

@interface YZGCollectionViewController ()

@end

@implementation YZGCollectionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createDataSourceAndLayout];
    NSAssert(self.layout, @"必须在 ""createDataSourceAndLayout方法中设置 self.layout 为你创建的 layout""");
    [self creatCollectionView];
}

-(void)creatCollectionView{
	CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
	CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
	CGFloat tabBarHeight =  self.tabBarController.tabBar.bounds.size.height;
	CGFloat statusBar = [[UIApplication sharedApplication] statusBarFrame].size.height;
	CGFloat navBarHeight = 44.0;
    CGFloat height = screenHeight - statusBar - navBarHeight -tabBarHeight;
    self.collectionView = [[YZGCollectionView alloc]initWithFrame:CGRectMake(0, 0,screenWidth, height) collectionViewLayout:self.layout];
    self.collectionView.yzgDelegate = self;
    self.collectionView.yzgDataSource = self.dataSource;
    self.collectionView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.collectionView];
    for (NSString *cellClassName in self.cellClassName) {
        [self.collectionView registerNib:[UINib nibWithNibName:cellClassName bundle:[NSBundle bundleForClass:NSClassFromString(cellClassName)]] forCellWithReuseIdentifier:cellClassName];
    }
}

-(void)createDataSourceAndLayout {
    @throw @"You Must implement This Mehtod ";
}
@end
